package cn.expopay.mail;

import cn.expopay.mail.model.Mail;
import cn.expopay.mail.util.FileUtils;
import cn.expopay.mail.util.MailUtil;

import java.util.Arrays;
import java.util.Properties;

/**
 * Created by jj02 on 2016/8/12.
 */
public class SendMail {

    public static void main(String[] args) {
        Mail mail = new Mail();
        mail.setHost("smtp.exmail.qq.com"); // 设置邮件服务器,如果不用163的,自己找找看相关的
        mail.setSender("jiangjun@gznb.com");
        Properties properties = FileUtils.getProperties("receievers.properties");
        if(properties == null || properties.isEmpty()){
            return;
        }
        String recievers = properties.getProperty("recievers");
        String[] recieveArr = recievers.split(",");
        mail.setName("江俊");
        mail.setReceivers(recieveArr); // 接收人
        mail.setUsername("jiangjun@gznb.com"); // 登录账号,一般都是和邮箱名一样
        mail.setPassword("Jj19900130"); // 发件人邮箱的登录密码
        mail.setSubject("redis异常");
        mail.setMessage("redis master异常，已进行主从切换！请即时解决异常的redis实例！");
        new MailUtil().send(mail);
    }
}
